package com.itheima.homework10;

import java.util.ArrayList;
import java.util.stream.Stream;

/*
		2. Stream流：练习 最后的综合案例代码
 */
public class Test02 {
    public static void main(String[] args) {
      ArrayList<String> manList=new ArrayList<>();
      manList.add("张国立");
      manList.add("霍建华");
      manList.add("陈晓");
      manList.add("胡歌");
      manList.add("霍飞宇");
      manList.add("徐向前");
        ArrayList<String > womenList=new ArrayList<>();
        womenList.add("郑爽");
        womenList.add("杨紫");
        womenList.add("迪丽热巴");
        womenList.add("刘仴涛");
        womenList.add("杨幂");
        womenList.add("周依云");
        Stream<String> stream1 = manList.stream().filter(s -> s.length() == 3).filter(s -> s.startsWith("霍")).limit(2);
        Stream<String> stream2 = womenList.stream().filter(s -> s.startsWith("杨")).skip(1);
        Stream<String> stream3 = Stream.concat(stream1, stream2);
        //不难直接打印，需要通过lambda表达式遍历
                stream3.forEach(s-> System.out.println(s));

    }
}
